package com.haierp.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.haierp.mapper.TaskDailyOrderUncompleteMapper;
import com.haierp.model.TaskDailyOrderUncomplete;
import com.haierp.service.ITaskDailyOrderUncompleteService;
import com.haierp.vo.TaskDailyOrderUncompleteQueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.framework.service.impl.SuperServiceImpl;
import com.haierp.util.JsonPageResult;

@Service
public class TaskDailyOrderUncompleteServiceImpl extends SuperServiceImpl<TaskDailyOrderUncompleteMapper,TaskDailyOrderUncomplete>  implements ITaskDailyOrderUncompleteService {
	
	@Autowired
	private TaskDailyOrderUncompleteMapper nocompleteTaskDailyOrderMapper;
	
	@Override
	public JsonPageResult<List<TaskDailyOrderUncomplete>> queryNocomplete(TaskDailyOrderUncompleteQueryVO taskDailyOrderUncompleteQueryVO) {
		JsonPageResult<List<TaskDailyOrderUncomplete>> receiptResult = new JsonPageResult<>();
		//1、查询总的记录数量
		Integer totalCount =  this.baseMapper.queryNocompleteTaskDailyTimeCount(taskDailyOrderUncompleteQueryVO);
		
		//2、查询分页记录
		if(totalCount!=null&&totalCount!=0){
			receiptResult.buildPage(totalCount, taskDailyOrderUncompleteQueryVO);
			List<TaskDailyOrderUncomplete> receipts = this.baseMapper.queryNocompleteTaskDailyTime(taskDailyOrderUncompleteQueryVO);
			receiptResult.setData(receipts);
		}else{
			List<TaskDailyOrderUncomplete> receipts  = new ArrayList<>();
			receiptResult.setData(receipts);
		}
		return receiptResult;
	}

	@Override
	public List<TaskDailyOrderUncomplete> queryNocompleteTaskDaily(String currentlyDate) {
		
		return nocompleteTaskDailyOrderMapper.queryNocompleteTaskDaily(currentlyDate);
	}

}
